package GUI.PrincipalGUI;

import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import java.awt.Font;
import javax.swing.SwingConstants;

import GUI.MainGUI;
import javax.swing.JTextField;

@SuppressWarnings("serial")
public class ReportGUI  extends JPanel  implements ActionListener  {
	public ReportGUI(MainGUI mainGUI) {
		super();
		initialize();
	}
	
	private MainGUI mainGUI;
	private JButton btnSetQusetion;
	private JButton btnGetExam;
	private JButton btnGetGrade;
	private JButton btnExit;
	private JButton btnMainMenu;
	private JButton btnStaticReports;
	private	JLabel lblWaitingToApprove;
	private JLabel lblNum;
	private JComboBox cmboxWait2Approve;
	private	JLabel lblExamWaitingTo;
	

	
	private void initialize() {
		setBorder(new TitledBorder(null, "Princiapal reports:", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		setBackground(SystemColor.activeCaption);
		setBounds(0,0,MainGUI.setX,MainGUI.setY);
		setLayout(null);		

		add(GETbtnSetQusetion());
		add(GETbtnGetExam());
		add(GETbtnGetGrade());
		add(GETbtnExit());
		add(GETbtnMainMenu());
		add(GETbtnStaticReports());
		add(GETlblWaitingToApprove());
		add(GETlblNum());
		add(GETcmboxWait2Approve());
		add(GETlblExamWaitingTo());
	}
	
	private JButton GETbtnSetQusetion()
	{
		if(btnSetQusetion==null)
		{
			btnSetQusetion = new JButton("get question");
			btnSetQusetion.setBounds(117, 32, 105, 23);
			btnSetQusetion.addActionListener(this);
		}
		return btnSetQusetion;
	}
	
	
	private JButton GETbtnGetExam()
	{
		if(btnGetExam==null)
		{
			btnGetExam = new JButton("get exam");
			btnGetExam.setBounds(117, 77, 105, 23);
			btnGetExam.addActionListener(this);			
		}
		return btnGetExam;
	}
	
	private JButton GETbtnGetGrade()
	{
		if(btnGetGrade==null)
		{		
			btnGetGrade = new JButton("get  grade");
			btnGetGrade.setBounds(117, 121, 105, 23);
			btnGetGrade.addActionListener(this);
		}
		return btnGetGrade;
			
	}
	
	private JButton GETbtnExit()
	{
		if (btnExit==null)
		{
			btnExit = new JButton("exit");
			btnExit.setBounds(369, 448, 89, 23);	
			btnExit.addActionListener(this);
		}
		return btnExit;
	}

	
	private JButton GETbtnMainMenu()
	{
		if (btnMainMenu==null)
		{
			btnMainMenu = new JButton("main menu");
			btnMainMenu.setBounds(32, 449, 100, 23);
			btnMainMenu.addActionListener(this);			
		}
		return btnMainMenu;
	}

	private JButton GETbtnStaticReports()
	{
		if(btnStaticReports==null)
		{
			btnStaticReports = new JButton("static reports");
			btnStaticReports.setBounds(117, 165, 105, 23);
			btnStaticReports.addActionListener(this);	
		}
		return  btnStaticReports;
	}
	
	private	JLabel GETlblWaitingToApprove()
	{
		if(lblWaitingToApprove==null)
		{
			lblWaitingToApprove = new JLabel("waiting to approve:");
			lblWaitingToApprove.setBounds(43, 424, 94, 14);
		}
		return lblWaitingToApprove;
	}
	
	
	private JLabel GETlblNum()
	{
		if(lblNum==null)
		{
			lblNum = new JLabel("0");
			lblNum.setBounds(147, 424, 15, 14);
		}
		return lblNum;
	}
	
	
	private JComboBox GETcmboxWait2Approve()
	{
		if(cmboxWait2Approve==null)
		{
			cmboxWait2Approve = new JComboBox();
			cmboxWait2Approve.setToolTipText("wait to approve");
			cmboxWait2Approve.setBounds(22, 227, 436, 20);
			cmboxWait2Approve.addActionListener(this);
		}
		return cmboxWait2Approve;
	}
	

	private	JLabel GETlblExamWaitingTo()
	{
		if(lblExamWaitingTo==null)
		{
			lblExamWaitingTo = new JLabel("exam waiting to approve:");
			lblExamWaitingTo.setBounds(32, 205, 137, 14);
		}
		return lblExamWaitingTo;
	}


@Override
public void actionPerformed(ActionEvent e) {
	
	if(e.getSource() == btnGetExam){
		MainGUI.handleprincipalGUI(1);
		
	}
	if(e.getSource() == btnSetQusetion){
		MainGUI.handleprincipalGUI(1);	}
	
	if(e.getSource() == btnGetGrade){
		MainGUI.handleprincipalGUI(1);
		
	}
	if(e.getSource() == btnExit){
		MainGUI.handleprincipalGUI(1);
	}
	if(e.getSource() == btnMainMenu){
		MainGUI.handleprincipalGUI(1);
	}	
	
	if(e.getSource() == btnStaticReports){
		MainGUI.handleprincipalGUI(1);
		
	}
	if(e.getSource() == cmboxWait2Approve){
		MainGUI.handleprincipalGUI(1);
	}



}
}
